package com.twu.biblioteca.library;

import com.twu.biblioteca.book.Book;
import com.twu.biblioteca.book.BookDAOFactory;
import com.twu.biblioteca.item.ItemDAO;
import com.twu.biblioteca.item.Items;
import com.twu.biblioteca.movie.Movie;
import com.twu.biblioteca.movie.MovieDAOFactory;

/**
 * Created by Enrico on 18/09/2014.
 */
public class Catalogue {

    private Items<Book> books;
    private Items<Movie> movies;

    public Catalogue() {
        setup();
    }

    @SuppressWarnings("unchecked")
    public void setup(){
        this.books = readItems(BookDAOFactory.build());
        this.movies = readItems(MovieDAOFactory.build());
    }

    private Items readItems(ItemDAO itemDao) {
        return itemDao.getItems();
    }

    public void showBooks(){
        books.list();
    }

    public void showMovies(){
        movies.list();
    }

    public Items<Book> getBooks(){
        return books;
    }

    public Items<Movie> getMovies(){
        return movies;
    }
}
